home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
pas_all.zip
/
TI317.ASC
< prev
next >
Wrap
Text File
|
1992-08-12
|
4KB
|
199 lines
PRODUCT : TURBO PASCAL TUTOR NUMBER : 317
VERSION : 2.00
OS : PC-DOS
DATE : July 17, 1986 PAGE : 1/3
TITLE : RECURSION MODIFICATIONS
The following is a list of modifications to be made to the file
RECUR.EX in version 2.0 of the Turbo Pascal Tutor. The changes
prevent the program from hanging after deleting the root of the
binary tree.
NOTE: This code modification updates your version of the Turbo
Pascal Tutor to version 2.00A.
1. Make a backup copy of the file RECUR.EX.
2. Load the file RECUR.EX into the Turbo Pascal editor.
3. In the function LeftNode:
Change from:
.
.
.
LeftNode := Node^.Parent^.Left = Node;
.
.
.
Change to:
.
.
.
LeftNode := (Node^.Parent^.Left = Node) or (Node = nil);
{ Ver. 2.00A }
. { Modification }
.
.
4. In the procedure LeftAndRightNil, change from:
.
.
.
if LeftNode(Node) then
Node^.Parent^.Left := Nil
else
Node^.Parent^.Right := Nil
.
.
.
Change to:
PRODUCT : TURBO PASCAL TUTOR NUMBER : 317
VERSION : 2.00
OS : PC-DOS
DATE : July 17, 1986 PAGE : 2/3
TITLE : RECURSION MODIFICATIONS
.
.
.
if Node <> Root then { Ver. 2.00A Addition }
begin { Ver. 2.00A Addition }
if LeftNode(Node) then
Node^.Parent^.Left := Nil
else
Node^.Parent^.Right := Nil
end; { Ver. 2.00A Addition }
.
.
.
5. In the procedure LeftNil, change from:
.
.
.
if LeftNode(Node) then
Node^.Parent^.Left := Node^.Right
else
Node^.Parent^.Right := Node^.Right;
.
.
.
Change to:
.
.
.
if Node <> Root then { Ver. 2.00A Addition }
begin { Ver. 2.00A Addition }
if LeftNode(Node) then
Node^.Parent^.Left := Node^.Right
else
Node^.Parent^.Right := Node^.Right;
end; { Ver. 2.00A Addition }
.
.
.
6. In the procedure RightNil, change from:
.
.
PRODUCT : TURBO PASCAL TUTOR NUMBER : 317
VERSION : 2.00
OS : PC-DOS
DATE : July 17, 1986 PAGE : 3/3
TITLE : RECURSION MODIFICATIONS
.
if LeftNode(Node) then
Node^.Parent^.Left := Node^.Left
else
Node^.Parent^.Right := Node^.Left;
.
.
.
Change to:
.
.
.
if Node <> Root then { Ver. 2.00A Addition }
begin { Ver. 2.00A Addition }
if LeftNode(Node) then
Node^.Parent^.Left := Node^.Left
else
Node^.Parent^.Right := Node^.Left;
end; { Ver. 2.00A Addition }
.
.
.
7. Save the file.
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.